package sundun.sharding.constant;

import ch.qos.logback.core.pattern.parser.Parser;

import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;

public class ShardingConstant {

    public final static String SPRING_SHARDING_SPHERE_ENABLED="spring.shardingsphere.enabled";
    public final static String SPRING_SHARDING_SPHERE_ASPECT_ENABLED="spring.shardingsphere.aspect.enabled";
    public final static String SPRING_SHARDING_SPHERE_TABLES_COMPLEX_COLUMNS="spring.shardingsphere.rules.sharding.tables.%s.table-strategy.complex.sharding-columns";


    /**
     * Date类型的分片时间格式
     */
    public static final SimpleDateFormat TABLE_SHARD_DATE_FORMATTER = new SimpleDateFormat("yyyyMM");

    /**
     * 完整时间格式
     */
    public static final DateTimeFormatter DATE_TIME_YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");

    /**
     * 分片时间格式
     */
    public static final DateTimeFormatter TABLE_SHARD_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMM");

    /**
     * 完整时间格式
     */
    public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyyMMdd HH:mm:ss");
    /**
     * 完整时间格式
     */
    public static final SimpleDateFormat DATE_TIME_FORMATTER_SPILE = new SimpleDateFormat("yyyy-MM-dd");
    public static final SimpleDateFormat DATE_TIME_FORMATTER_YEAR = new SimpleDateFormat("yyyy");

    /**
     * 表分片符号，例：t_user_202201 中，分片符号为 "_"
     */
    public static final String TABLE_SPLIT_SYMBOL = "_";

    /**
     * 默认逻辑数据库
     */
    public static final String DB_NAME = "ds0";
    /**
     * 数据迁移-数据库双写默认原数据库名
     */
    public static final String MASTER_NAME = "origin";




    public static final String SHARDING_DATA_SOURCE_NAME = "shardingSphereDataSource";
}
